<template>
  <div class="note">
    <h6 class="note-title">企业信息</h6>
    <section class="note-container">
      <p>企业名称：{{ certificationInfo.tenantName || '--' }}</p>
      <p>统一信用代码：{{ certificationInfo.uscCode || '--' }}</p>
      <p v-if="isShowAuthWay">认证方式：{{ authWayText }}</p>
    </section>
    <h6 class="note-title">法定代表人信息</h6>
    <section class="note-container">
      <p>姓名：{{ certificationInfo.legalPerson || '--' }}</p>
      <p>证件号码：{{ certificationInfo.identificationNumber || '--' }}</p>
      <p>证件注册日期：{{ certificationInfo.certificateRegistrationDate || '--' }}</p>
      <p>证件到期日期：{{ certificationInfo.certificateExpirationDate || '--' }}</p>

      <p>法人手机号码：{{ certificationInfo.corporatePhone || '--' }}</p>
      <p></p>

      <div class="flex" style="width: 50%">
        <p>身份证头像面：</p>
        <img
          style="width: 101px; height: 101px"
          v-if="certificationInfo.photoFrontUrl"
          :src="certificationInfo.photoFrontUrl"
          alt=""
          @click="openWindow(certificationInfo.photoFrontUrl)"
        />
        <p v-else>--</p>
      </div>
      <div class="flex" style="width: 50%">
        <p>身份证国徽面：</p>
        <img
          style="width: 101px; height: 101px"
          v-if="certificationInfo.photoBackUrl"
          :src="certificationInfo.photoBackUrl"
          alt=""
          @click="openWindow(certificationInfo.photoBackUrl)"
        />
        <p v-else>--</p>
      </div>
    </section>
    <h6 class="note-title">经办人信息</h6>
    <section class="note-container">
      <p>姓名：{{ certificationInfo.contactsIdentificationName || '--' }}</p>
      <p>证件号码：{{ certificationInfo.contactsIdentificationCard || '--' }}</p>
      <p>手机号码：{{ certificationInfo.contactsIdentificationNumber || '--' }}</p>
    </section>
  </div>
</template>

<script>
export default {
  name: 'CertificationInfo',
  props: {
    certificationInfo: {
      type: Object,
    },
  },
  computed: {
    isShowAuthWay() {
      return this.$route.query.appCode === 'JFS' || this.$route.query.appCode === 'WMR'
    },
    authWayText() {
      let text = ''
      if (this.$route.query.appCode === 'JFS') {
        text = '小额打款'
      } else if (this.$route.query.appCode === 'WMR') {
        text = '金税盘认证'
      }
      return text
    },
  },
  data() {
    return {}
  },
  methods: {
    openWindow(url) {
      window.open(url, '__blank')
    },
  },
}
</script>

<style lang="scss" scoped>
.note {
  &-title {
    color: $gray;
    font-size: $f-s-16;
    margin-bottom: 18px;
  }
  &-container {
    display: flex;
    flex-wrap: wrap;
    color: $gray;
    font-size: $f-s-16;
    margin-bottom: 8px;
    > p {
      width: 50%;
      margin-bottom: 10px;
    }
  }
}
</style>
